CREATE PROCEDURE coreWFExitActionsSave
(
	@id					int output,
	@FK_ExitPathID		int,
	@Rank				int,
	@Method				nvarchar(500),
	@PropertyBag		ntext
)
AS
BEGIN

	IF @id = -1
	BEGIN
		SET NOCOUNT ON;

		INSERT INTO WFExitActions (FK_ExitPathID, Rank, Method, PropertyBag)
		VALUES (@FK_ExitPathID, @Rank, @Method, @PropertyBag);

		SET NOCOUNT OFF;
		SELECT @id = @@IDENTITY;

	END
	ELSE
	BEGIN

		UPDATE WFExitActions SET
			Rank		= @Rank,		
			Method		= @Method,
			PropertyBag	= @PropertyBag
		WHERE PK_ID=@id;
		
	END
	
END
